package org.jgs1904.oopbase.method;

/**
 * @author: 默苍璃
 * @date: 2022-09-13 13:14
 */
public class TestParamPerson {
    public static void main(String[] args) {
        ParamPerson p = new ParamPerson();
        int n = 15; // n的值为15
        p.setAge(n); // 传入n的值
        System.out.println(p.getAge()); // 15
        n = 20; // n的值改为20
        System.out.println(p.getAge()); // 15还是20?

        String[] fullname = new String[]{"r", "Simpson"};
        p.setName(fullname); // 传入fullname数组
        System.out.println(p.getName()); // "Homer Simpson"
        fullname[0] = "Bart"; // fullname数组的第一个元素修改为"Bart"
        System.out.println(p.getName()); // "Homer Simpson"还是"Bart Simpson"?

        String bob = "Bob";
        p.setName1(bob); // 传入bob变量
        System.out.println(p.getName1()); // "Bob"
        bob = "Alice"; // bob改名为Alice
        System.out.println(p.getName1()); // "Bob"还是"Alice"?
    }

}
